<template>
  <div class="order-container">
    <el-card class="page-left">
      <div class="page-left-top">
        <el-form :inline="true" class="query-form" ref="queryForm" :model="queryForm" label-position="left" status-icon size="small">
          <el-form-item label="衣品" prop="name">
            <el-input v-model="queryForm.name" clearable placeholder="请输入衣品名称" />
          </el-form-item>
        </el-form>
      </div>
      <div class="page-left-content">
        <el-table ref="myTable" :data="tableData" :header-cell-style="{background:'#f2f3f5'}" height="calc(100% - 40px)" border style="width:100%;" size="small">
          <el-table-column type="index" label="序号" width="50" align="center" />
          <el-table-column v-for="(item, index) in tableColumns" :key="index" :prop="item.prop" :label="item.label" :min-width="item.minWidth" :show-overflow-tooltip="true" align="center">
            <template slot-scope="scope">
              <div v-if="item.prop === 'num'">
                <el-input-number v-model="scope.row[item.prop]" @change="numChange" :min="1" size="mini"></el-input-number>
              </div>
              <div v-else-if="item.prop === 'time'">
                <span>{{ Moment(scope.row[item.prop]).format('YYYY-MM-DD')}}</span>
              </div>
              <div v-else>
                <span>{{ scope.row[item.prop] }}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="100" align="center">
            <template slot-scope="scope">
              <el-button type="danger" @click="onDel(scope.row)" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- <div style="margin-top: 10px;">
          <el-pagination :total="total" layout="total, sizes, prev, pager, next, jumper"
            :current-page="page"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div> -->
      </div>
    </el-card>
    <div class="page-right">
      <el-card class="page-right-card">
        <div slot="header" class="clearfix">
          <span>卡片名称</span>
          <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
        </div>
        <div>111111</div>
      </el-card>
      <el-card class="page-right-card">
        <div slot="header" class="clearfix">
          <span>卡片名称</span>
          <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
        </div>
        <div>111111</div>
      </el-card>
    </div>
  </div>
</template>

<script>
import Moment from 'moment'
import {pageSizes} from '@/utils/table'
export default {
  name: '开单',
  components: {
    Moment,
  },
  data() {
      return {
        Moment,
        queryForm: {
          name: '',
        },
        page: 1,
        pageSize: 20,
        pageSizes,
        total: 0,
        tableColumns: [
          { prop: 'name', label: '衣品名称', minWidth: '15%' },
          { prop: 'img', label: '图片', minWidth: '15%' },
          { prop: 'money', label: '金额', minWidth: '10%' },
          { prop: 'num', label: '数量', minWidth: '20%' },
        ],
        tableData: [
          {name: '用户1', cardNum: '123456789', phone: '18512345678', money: 100, num: 20},
          {name: '用户2', cardNum: '987654321', phone: '18512345678', money: 100, num: 20},
          {name: '用户2', cardNum: '987654321', phone: '18512345678', money: 100, num: 20},
        ],
      }
    },
    mounted() {
      this.onSearch(1)
    },
    methods: {
      //查询
      onSearch(page) {
        this.page = page ? page : this.page
      },
      onDel(row) {
        
      },
      //数量change
      numChange(val) {

      },
      //保存
      onSaveEdit() {

      },
      handleSizeChange(val) {
        this.pageSize = val
        this.onSearch()
      },
      handleCurrentChange(val) {
        this.page = val
        this.onSearch()
      },
    }
}
</script>

<style lang="scss" scoped>
.order-container{
  width: 100%;
  height: 100%;
  .page-left{
    width: 55%;
    height: 100%;
    float: left;
    .page-left-top{
      width: 100%;
      height: 50px;
    }
    .page-left-content{
      width: 100%;
      height: calc(100% - 50px);
    }
  }
  .page-right{
    width: calc(45% - 20px);
    margin-left: 15px;
    height: 100%;
    float: left;
    .page-right-card{
      width: 100%;
      height: calc(50% - 5px);
      &:first-child{
        margin-bottom: 10px;
      }
    }
  }
}
</style>
